$(document).ready(function(){
	$("#functionNav").attr("href",navAddr);
	if(getUserRight()){
		var role = userInfo.roleid;
		if(role.indexOf("kufangchakanyuan")>-1){
			//获取并填充保管部门
			var bgbmJson = ajaxResult("get",false,ProjectName+"/sysmanage.getIdAndNameInjb.do",{'tableName':'jb_bgbm'});
			loadSelect("#bgbmid",bgbmJson.rows,'id','name');	
		}else{
			$("#form1").hide();
		}
	}
	createTableOrderBy('#kfGuanli','antiques/kfquery.getKuFangList.do','id',tblColTitle);
	//点击查询按钮
	 $("#search_btn").click(function(){
		 refreshTable('#kfGuanli','#form1');
	 });
})

var tblColTitle = [{
	        field: 'bgbmmc',
	        title: '部门',
	        sortable:true
	    },
	    {
	        field: 'kfmc',
	        title: '库房',
	        sortable:true
	    }, 
	    {
	        field: 'cpsl',
	        title: '藏品数',
	        formatter:function(value,row,index){
	        	if(value>0)
	        		return '<a href="kuFangCpInfo.html?szkf='+row.kfid+'&type=cpsl">'+value+'</a>';
	        	else return value;
	        }
	    }, {
	        field: 'qbzk',
	        title: '全部在库藏品数',
	        formatter: function(value, row, index) {
	        	if(value>0)
	        		return '<a href="kuFangCpInfo.html?szkf='+row.kfid+'&type=qbzk">'+value+'</a>';
	        	else return value;
	      	}
	    }, {
	        field: 'qbbzk',
	        title: '全部不在库藏品数',
	        formatter: function(value, row, index) {
	        	if(value>0)
	        		return '<a href="kuFangCpInfo.html?szkf='+row.kfid+'&type=qbbzk">'+value+'</a>';
	        	else return value;
	      	}
	    }, {
	        field: 'bfzk',
	        title: '部分在库藏品数',
	        formatter: function(value, row, index) {
	        	if(value>0)
	        		return '<a href="kuFangCpInfo.html?szkf="'+row.kfid+'&type=bfzk>'+value+'</a>';
	        	else return value;
	      	}
	    }]